﻿
using SangaiTech.Abstractions;
using SangaiTech.Infrastructure;
using SimpleInjector;
using System.Web.Mvc;
namespace SangaiTech.Bootstrap
{
    public class Bootstrapper
    {
        public static Container Container { get; private set; }

        public static void Register()
        {
            Container = new Container();
            //====================================================
            Container.Options.AllowOverridingRegistrations = true;
            //====================================================
            SangaiTech.Infrastructure.Bootstrapper.Register(Container);
            SangaiTech.Core.Bootstrapper.Register(Container);
        }

        public static IDependencyResolver GetDependencyResolver()
        {
            return new SimpleInjector.Integration.Web.Mvc.SimpleInjectorDependencyResolver(Container);
        }
    }

    public class WebApiBootstrapper
    {
        public static Container Container { get; private set; }

        public static void Register()
        {
            Container = new Container();
            //====================================================
            Container.Options.AllowOverridingRegistrations = true;
            //====================================================
            Container.RegisterWebApiRequest<IEmployeeRepository, EmployeeRepository>();
        }

        public static System.Web.Http.Dependencies.IDependencyResolver GetDependencyResolver()
        {
            return new SimpleInjector.Integration.WebApi.SimpleInjectorWebApiDependencyResolver(Container);
        }
    }
}
